#include "iostream"
#include "stdio.h"
#include <string.h>
using namespace std;
int map[406][406];
struct note {
    int x;
    int y;
    int step;
} queue[160006];
int head = 0, tail = 0;
int change[8][2] = { { 1,  2 },
                     { -1, 2 },
                     { 1,  -2 },
                     { -1, -2 },
                     { -2, 1 },
                     { 2,  1 },
                     { -2, -1 },
                     { 2,  -1 } };

int main() {
    int n, m, sx, sy;
    cin >> n >> m >> sx >> sy;
    memset(map ,-1, sizeof(map));//标记为-1
    queue[tail].x = sx-1;
    queue[tail].y = sy-1;
    queue[tail].step = 0;
    tail++;
    map[sx - 1][sy - 1] = 0;//开始标记
    while (head < tail) {
        for (int t = 0; t < 8; t++) {
            int nx = queue[head].x + change[t][0];
            int ny = queue[head].y + change[t][1];
            if (nx >= 0 && nx < n && ny >= 0 && ny < m && map[nx][ny]==-1) {
                queue[tail].x = nx;
                queue[tail].y = ny;
                queue[tail].step = queue[head].step + 1;
                tail++;
                map[nx][ny] = queue[head].step + 1;
            }
        }
        head++;
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            printf("%-5d", map[i][j]);
        }
        cout << endl;
    }
    return 0;
}